package com.neusoft.dao.impl;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.neusoft.dao.PaperDao;
import com.neusoft.domain.Department;
import com.neusoft.domain.Job;
import com.neusoft.domain.paper.HirePaperFilter;
import com.neusoft.domain.paper.New_employee_paper;
import com.neusoft.domain.paper.leave_employee_paper;
import com.neusoft.domain.paper.dptTf_employee_paper;
import com.neusoft.domain.paper.jbTf_employee_paper;
import com.neusoft.mapper.paperMapper;
import com.neusoft.util.MybatisUtils;

@Repository("paperDaoImpl")
public class PaperDaoImpl implements PaperDao{
	private  MybatisUtils  mybatisUtils;
	
	public void setMybatisUtils(MybatisUtils mybatisUtil) {
		this.mybatisUtils = mybatisUtil;
	}

	/*
	 * 根据部门、日期获取新聘员工报表信息
	 */
	@Override
	public List<New_employee_paper> getUsers(HirePaperFilter hirePaperFilter) {
		SqlSession session = mybatisUtils.openSession();
		List<New_employee_paper> users = session.getMapper(paperMapper.class).getUsers(hirePaperFilter);
		mybatisUtils.closeSession(session);
		
		return users;
	}

	/*
	 * 获取部门名
	 */
	@Override
	public String getUser_department(int department) {
		SqlSession session = mybatisUtils.openSession();
		String user_department = session.getMapper(paperMapper.class).getUser_department(department);
		mybatisUtils.closeSession(session);
		return user_department;
	}

	/*
	 * 根据日期获取新聘员工报表信息
	 */
	@Override
	public List<New_employee_paper> getUsersAll(HirePaperFilter hirePaperFilter) {
		SqlSession session = mybatisUtils.openSession();
		List<New_employee_paper> users = session.getMapper(paperMapper.class).getUsersAll(hirePaperFilter);
		mybatisUtils.closeSession(session);
		
		return users;
	}

	@Override
	public List<Department> getDepartment() {
		SqlSession session = mybatisUtils.openSession();
		List<Department> departments = session.getMapper(paperMapper.class).getDepartment();
		mybatisUtils.closeSession(session);
		return departments;
	}

	@Override
	public List<leave_employee_paper> getFiredUsers(HirePaperFilter hirePaperFilter) {
		SqlSession session = mybatisUtils.openSession();
		List<leave_employee_paper> users = session.getMapper(paperMapper.class).getFiredUsers(hirePaperFilter);
		mybatisUtils.closeSession(session);
		
		return users;
	}

	@Override
	public List<leave_employee_paper> getFiredUsersAll(HirePaperFilter hirePaperFilter) {
		SqlSession session = mybatisUtils.openSession();
		List<leave_employee_paper> users = session.getMapper(paperMapper.class).getFiredUsersAll(hirePaperFilter);
		mybatisUtils.closeSession(session);
		
		return users;
	}

	@Override
	public List<dptTf_employee_paper> getDptTfUsers(HirePaperFilter hirePaperFilter) {
		SqlSession session = mybatisUtils.openSession();
		List<dptTf_employee_paper> users = session.getMapper(paperMapper.class).getDptTfUsers(hirePaperFilter);
		mybatisUtils.closeSession(session);
		return users;
	}

	@Override
	public List<jbTf_employee_paper> getJbTfUsers(HirePaperFilter hirePaperFilter) {
		SqlSession session = mybatisUtils.openSession();
		List<jbTf_employee_paper> users = session.getMapper(paperMapper.class).getJbTfUsers(hirePaperFilter);
		mybatisUtils.closeSession(session);
		return users;
	}

	@Override
	public String getUser_job(int job) {
		SqlSession session = mybatisUtils.openSession();
		String user_job = session.getMapper(paperMapper.class).getUser_job(job);
		mybatisUtils.closeSession(session);
		return user_job;
	}

	
	
}
